package qq.qqClient;

import qq.Message;
import qq.User;
import java.util.Scanner;

public class QQClient {

    static UserClientService clientService = new UserClientService();
    // 界面 1
    public static User viewMain(){
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("============欢迎来到QQ登录界面=============");
            System.out.println("\t\t\t 1 登录");
            System.out.println("\t\t\t 2 退出");
            System.out.print("请输入你的选择: ");
            int key = scanner.nextInt();
            switch (key){
                case 1:
                    System.out.print("请输入用户ID: ");
                    int id = scanner.nextInt();
                    System.out.print("请输入密码: ");
                    String password = scanner.next();
                    User user = new User(id, password);
                    boolean loop = true;
                    if (clientService.checkUser(user)){ // 验证成功,进入二级菜单
                        while (loop){
                            System.out.println("=========欢迎 "+user.getId()+"=============");
                            System.out.println("\t 1 显示在线用户");
                            System.out.println("\t 2 群发消息");
                            System.out.println("\t 3 私聊消息");
                            System.out.println("\t 4 发送文件");
                            System.out.println("\t 5 退出系统");
                            System.out.print("请输入你的选择: ");
                            int key2 = scanner.nextInt();
                            switch (key2){
                                case 1:
                                    System.out.println("显示在线用户");
                                    break;
                                case 2:
                                    System.out.println("群发消息");
                                    break;
                                case 3:
                                    System.out.println("发送消息");
                                    break;
                                case 4:
                                    System.out.println("发送文件");
                                    break;
                                case 5:
                                    loop = false;
                                    break;
                            }
                        }
                    }else {
                        System.out.println("==============登录失败============");
                    }
                case 2:
                    System.exit(0);
            }
        }
    }

    public static void main(String[] args){

        viewMain();
    }
}
